﻿<%@ Page Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="projekt.aspx.cs" Inherits="WebApplication5.Pages.projekt" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContainerPlaceHolder" runat="server">
	<form id="form1" runat="server">
		<div class="panel-group" id="accordion">
			<div class="panel panel-default">
				<a data-toggle="collapse" data-parent="#accordion" href="#collapseTwo">
					<div class="panel-heading">
						<h4 class="panel-title">Opret Projekt
						</h4>
					</div>
				</a>
				<div id="collapseTwo" class="panel-collapse collapse">
					<div class="panel-body">

								<span class="form-label">Navn</span>
                                <asp:TextBox ID="nameTb" CssClass="form-control" runat="server"> </asp:TextBox>
								
                                <span class="form-label">tid</span>
				                <asp:TextBox ID="timeTb" CssClass="form-control" runat="server"> </asp:TextBox>


								<span class="form-label">pris</span>
								<asp:TextBox ID="costTb" CssClass="form-control" runat="server"> </asp:TextBox>

								<span class="form-label">start dato</span>
								<asp:TextBox ID="startDateTb" CssClass="form-control" runat="server"> </asp:TextBox>

								<span class="form-label">slut dato</span>
								<asp:TextBox ID="endDateTb" CssClass="form-control" runat="server"> </asp:TextBox>

								<span class="form-label">status</span>
								<asp:TextBox ID="statusTb" CssClass="form-control" runat="server"> </asp:TextBox>

                                <asp:DropDownList ID="DropDownListAdd" runat="server" CssClass="form-control"></asp:DropDownList>

                                <br />


                                <asp:Button CssClass="btn btn-success btn-lg" ID="buttonCreate" OnClick="ButtonAdd_Click" Text="Opret" runat="server" />
					</div>
				</div>
			</div>
			<div class="panel panel-default">
				<a data-toggle="collapse" data-parent="#accordion" href="#collapseThree">
					<div class="panel-heading">
						<h4 class="panel-title">Ret Projekt
						</h4>
					</div>
				</a>
				<div id="collapseThree" class="panel-collapse collapse">
					<div class="panel-body">
						<asp:ScriptManager ID="ScriptManager2" runat="server" />
						<asp:UpdatePanel runat="server" ID="UpdatePanel2" UpdateMode="Conditional">
							<ContentTemplate>
								<Triggers>
									<asp:AsyncPostBackTrigger ControlID="UpdateButton1" EventName="Click" />
								</Triggers>
							
								<asp:DropDownList ID="DropDownListEdit" runat="server" CssClass="form-control"></asp:DropDownList>

								<asp:Button ID="UpdateButton1" CssClass="btn btn-warning" runat="server" Text="Hent Projekt" OnClick="ButtonGetProject_Click" /><br />

								<span class="form-label">Navn:</span>
								<asp:TextBox ID="nameTbe" runat="server" CssClass="form-control"></asp:TextBox>

								<span class="form-label">Tid:</span>
								<asp:TextBox ID="timeTbe" runat="server" CssClass="form-control"></asp:TextBox>

								<span class="form-label">Pris:</span>
								<asp:TextBox ID="priceTbe" runat="server" CssClass="form-control"></asp:TextBox>

								<span class="form-label">start dato:</span>
								<asp:TextBox ID="startDateTbe" runat="server" CssClass="form-control"></asp:TextBox>

								<span class="form-label">slut dato:</span>
								<asp:TextBox ID="endDateTbe" runat="server" CssClass="form-control"></asp:TextBox>

								<span class="form-label">status:</span>
								<asp:TextBox ID="statusTbe" runat="server" CssClass="form-control"></asp:TextBox>

                                <span class="form-label">Person</span>
                                <asp:DropDownList ID="DropDownListEditPerson" runat="server" CssClass="form-control"></asp:DropDownList>

                                <br />

								<asp:Button CssClass="btn btn-success btn-lg" ID="ButtonEdit" runat="server" Text="Rediger" OnClick="ButtonEdit_Click" />
							
								</ContentTemplate>
							</asp:UpdatePanel>
					</div>
				</div>
			</div>
			<div class="panel panel-default">
				<a data-toggle="collapse" data-parent="#accordion" href="#collapseFour">
					<div class="panel-heading">
						<h4 class="panel-title">Slet Projekt
						</h4>
					</div>
				</a>
				<div id="collapseFour" class="panel-collapse collapse">
					<div class="panel-body">
<%--						<asp:UpdatePanel runat="server" id="updatepanel3" UpdateMode="Conditional">
							<ContentTemplate>
								<Triggers>
									<asp:AsyncPostBackTrigger ControlID="ButtonDeleteHouse" EventName="Click" />
								</Triggers>--%>
						<asp:DropDownList ID="DropDownListDelete" runat="server" CssClass="form-control"></asp:DropDownList>
                        <br />
						<asp:Button CssClass="btn btn-danger" ID="ButtonDeleteProject" runat="server" Text="Slet Projekt" OnClick="ButtonDelete_Click" />
<%--								</ContentTemplate>
							</asp:UpdatePanel>--%>
					</div>
				</div>
                			<div class="panel panel-default">
				<a data-toggle="collapse" data-parent="#accordion" href="#collapseFive">
					<div class="panel-heading">
						<h4 class="panel-title">Alle Projekter
						</h4>
					</div>
				</a>
				<div id="collapseFive" class="panel-collapse collapse">
					<div class="panel-body">

						<table class="table table-striped">
							<thead>
								<tr>
									<th>navn</th>
									<th>tid</th>
                                    <th>pris</th>
                                    <th>start dato</th>
                                    <th>slut dato</th>
                                    <th>status</th>
								</tr>
							</thead>
							<tbody>
								<%
                                    List<WebApplication5.Model.Project> lou = pCtr.GetAllProject();
									var projectSource = from e in lou
													  select new
													  {
														  e.id,
														  e.cost,
                                                          e.endDate,
                                                          e.Login,
                                                          e.loginId,
                                                          e.name,
                                                          e.startDate,
                                                          e.status,
                                                          e.time,
                                                          e.Userstory
                                                          
													  };
								%>
								<% foreach (var lo in projectSource.ToList())
		   { %>
								<tr>
									<td><%=lo.name%></td>
									<td><%=lo.time%></td>
                                    <td><%=lo.cost%></td>
                                    <td><%=lo.startDate %></td>
                                    <td><%=lo.endDate %></td>
                                    <td><%=lo.status %></td>
								</tr>
								<% } %>
							</tbody>
						</table>

					</div>
				</div>
			</div>
			</div>
        </form>

</asp:Content>
